package com.zxh.blog.service.impl;

import com.zxh.blog.dao.PermissionDao;
import com.zxh.blog.domain.Permission;
import com.zxh.blog.domain.Role;
import com.zxh.blog.service.PermissionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PermissionServiceImpl implements PermissionService {

	@Autowired
	PermissionDao permissionDao;

	public List<Permission> findPermissionsByRoleId(Role role) {
		List permissions = permissionDao.findPermissionsByRoleId(role.getId());
		return permissions;
	}

	public List<Permission> selectByList() {
		List<Permission> list = permissionDao.selectByList();
		return list;
	}

	public Integer addPermission(Permission permission) {
		Integer save = permissionDao.save(permission);
		return save;
	}

	public void updatePermission(Permission permission) {
		permissionDao.update(permission);
	}

	public void deleteByIds(int[] ids) {
		permissionDao.deleteByIds(ids);
	}

}
